/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

/**
 *
 * @author sheked
 */
public class PaisosDB {
    private QueryRunner run;
    private MapListHandler mlh;

    public PaisosDB() throws NamingException, SQLException {
            Context ctx = new InitialContext();
            DataSource odsconn = (DataSource)ctx.lookup("jdbc/volansbd");
            run = new QueryRunner(odsconn);
            mlh = new MapListHandler();
    }

    public List<Map<String, Object>> consultaPaisos() throws SQLException {
        return run.query("select * from paisos", mlh);
    }

}
